﻿@model KL.Store.Web.Models.AddressModel
@using KL.Store.Core
<div id="divAddress">
    @using (Ajax.BeginForm("Update", "Address", new { }, new AjaxOptions { OnBegin = "userAddressInfoMessage('<i class=\"fa fa-spinner fa-spin\"></i>&nbsp;Lütfen Bekleyin.')", UpdateTargetId = "divMessage", HttpMethod = "Post" }, new { id = "saveForm", name = "saveForm", @class = "form-horizontal" }))
    {   
        @Html.HiddenFor(m => m.AddressId)
        <div class="form-group">
            <div class="col-xs-12 col-sm-5 col-md-5 col-lg-5">
                @Html.LabelFor(m => m.AddressName) <span class="required">*</span>
            </div>
            <div class="col-xs-12 col-sm-7 col-md-7 col-lg-7">
                @Html.TextBoxFor(m => m.AddressName, new { @class = "form-control", maxlength = "50" })
            </div>
        </div>
        <div class="form-group">
            <div class="col-xs-12 col-sm-5 col-md-5 col-lg-5">
                @Html.LabelFor(m => m.Name) <span class="required">*</span>
            </div>
            <div class="col-xs-12 col-sm-7 col-md-7 col-lg-7">
                @Html.TextBoxFor(m => m.Name, new { @class = "form-control", maxlength = "50" })
            </div>
        </div>
        <div class="form-group">
            <div class="col-xs-12 col-sm-5 col-md-5 col-lg-5">
                @Html.LabelFor(m => m.TaxOffice) - @Html.LabelFor(m => m.TaxNo) @Html.Raw(Parameters.CheckOutTCKNRequired && ViewBag.isCheckout == 1 ? " <span class=\"required\">*</span>" : "")
            </div>
            <div class="col-xs-12 col-sm-7 col-md-7 col-lg-7">
                <div class="col-xs-6 first last">
                    @Html.TextBoxFor(m => m.TaxOffice, new { @class = "form-control", maxlength = "50" })
                </div>
                <div class="col-xs-6 first last">
                    @Html.TextBoxFor(m => m.TaxNo, new { @class = "form-control", maxlength = "20" })
                </div>
            </div>
        </div>
        <div class="form-group">
            <div class="col-xs-12 col-sm-5 col-md-5 col-lg-5">
                @Html.LabelFor(m => m.Phone) <span class="required">*</span>
            </div>
            <div class="col-xs-12 col-sm-7 col-md-7 col-lg-7">
                @Html.TextBoxFor(m => m.Phone, new { @class = "form-control", maxlength = "15" })
            </div>
        </div>
        <div class="form-group">
            <div class="col-xs-12 col-sm-5 col-md-5 col-lg-5">
                @Html.LabelFor(m => m.Address1) <span class="required">*</span>
            </div>
            <div class="col-xs-12 col-sm-7 col-md-7 col-lg-7">
                @Html.TextBoxFor(m => m.Address1, new { @class = "form-control", maxlength = "40" })
            </div>
        </div>
        <div class="form-group">
            <div class="col-xs-12 col-sm-5 col-md-5 col-lg-5">
                &nbsp;
            </div>
            <div class="col-xs-12 col-sm-7 col-md-7 col-lg-7">
                @Html.TextBoxFor(m => m.Address2, new { @class = "form-control", maxlength = "40" })
            </div>
        </div>
        <div class="form-group">
            <div class="col-xs-12 col-sm-5 col-md-5 col-lg-5">
                @Html.LabelFor(m => m.PostalCode)
            </div>
            <div class="col-xs-12 col-sm-7 col-md-7 col-lg-7">
                @Html.TextBoxFor(m => m.PostalCode, new { @class = "form-control", maxlength = "5" })
            </div>
        </div>
        <div class="form-group">
            <div class="col-xs-12 col-sm-5 col-md-5 col-lg-5">
                @Html.LabelFor(m => m.County) <span class="required">*</span>
            </div>
            <div class="col-xs-12 col-sm-7 col-md-7 col-lg-7">
                @Html.TextBoxFor(m => m.County, new { @class = "form-control", maxlength = "20" })
            </div>
        </div>
        <div class="form-group">
            <div class="col-xs-12 col-sm-5 col-md-5 col-lg-5">
                @Html.LabelFor(m => m.City) <span class="required">*</span>
            </div>
            <div class="col-xs-12 col-sm-7 col-md-7 col-lg-7">
                @Html.DropDownListFor(m => m.City, new SelectList(Model.CityList, "CityId", "CityName"), new { @class = "form-control", @style = "width:150px" })
            </div>
        </div>
        <div class="form-group">
            <div class="addressMessage"></div>
        </div>
        <div class="buttons">
            <div class="right">
                <input type="submit" class="btn btn-custom1" value="Kaydet" />
            </div>
        </div>
    }
</div>
<script>
    function userAddressInfoMessage(text)
    {
        $('.addressMessage').html('<div style="margin-bottom: 15px;" class="bg-info bs-bgb"><p>' + text + '</p></div>');
    }
    function userAddressErrorMessage(text)
    {
        $('.addressMessage').html('<div style="margin-bottom: 15px;" class="bg-danger bs-bgb"><p>' + text + '</p></div>');
    }
    function userAddressSuccessMessage(text)
    {
        $('.addressMessage').html('<div style="margin-bottom: 15px;" class="bg-success bs-bgb"><p>' + text + '</p></div>');
    }
</script>
